const express = require('express');
const app = express();
const port = 3000;
const path = require('path');

// 允许静态文件访问
app.use(express.static(path.join(__dirname, 'public')));

// 提供 goods.json 文件
app.get('/api/goods', (req, res) => {
  res.sendFile(path.join(__dirname, 'src/db/goods.json'));
});

app.listen(port, () => {
  console.log(`Server running at http://localhost:${port}`);
});
